package cn.com.winson.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.com.winson.domin.User;
import cn.com.winson.service.UserService;


/*@RestController注解作用：返回的是json字符串，等同于@Controller+@ResponseBody两个注解的组合*/
@RestController
public class UserController {

	@Autowired
	private UserService userService;

	@GetMapping("/allUser")
	public List<User> userList() {
		return userService.getAllUser();
	}

	@GetMapping("/allUser/{id}")
	public User getUser(@PathVariable("id") String id) {
		return userService.getUserById(id);
	}
}
